package com.hqu.ms.detail;


import com.hqu.ms.entities.StoreEntivity;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

public class DetailPageAdapter extends FragmentStatePagerAdapter {

	int count = 0;
	Context mContext;
	StoreEntivity mStore;
	
	public DetailPageAdapter(FragmentManager fm, int length, StoreEntivity store) {
		super(fm);
		count = length;
		mStore = store;
	}

//	public DetailPageAdapter(FragmentManager fm, int length, Context context) {
//		super(fm);
//		count = length;
//		mContext = context;
//	}

	@Override
	public Fragment getItem(int position) {
		Fragment fragment = null;
		if(position == 0){
			fragment = DetailFragment_.builder().storeArg(mStore).build();
//			fragment = NewsFragment_.instantiate(mContext, NewsFragment_.class.getName());
		}else if(position == 1){
			fragment = CommentListFragment_.builder().store(mStore).build();
//			fragment = OfferFragment_.instantiate(mContext, OfferFragment_.class.getName());
		}else if(position == 2){
			fragment = AddCommentFragment_.builder().store(mStore).build();
//			fragment = LectureFragment_.instantiate(mContext, LectureFragment_.class.getName());
		}
		
		return fragment;
	}
	
	@Override
	public int getCount() {
		return count;
	}

}
